#ifndef _MOE_HISTORIC_
#define _MOE_HISTORIC_


#include "engine/Observer.hh"
#include "engine/Population.hh"
#include <iostream>
#include <fstream>

using namespace std;
/**
* this class makes a "dump" of the current population of a MOEA
*/
class Historic : public Observer {

private:

    ofstream* stream;

public:

    Historic(ofstream *stream) : Observer() {
        this->stream = stream;
    }

    virtual ~Historic() {
    }

    virtual void notify(const void *value) {

        MOEA *moea = (MOEA*) value;
        *stream << endl;
        *stream << moea->getGenerations() << endl;
        for (int i = 0; i < moea->getCurrent()->length(); i++) {
            moea->getCurrent()->get(i)->send(*stream);
            *stream << endl;
        }
    }
};

#endif
